<template>
  <!--        导航栏-->
  <div class="top">
    <div class="content">
      <div class="logo">
        <a href="../home">
          <img alt="" src="https://19jwshow.oss-cn-shenzhen.aliyuncs.com/wdad/logo/LOGO_home.png">
          <span>Website Design And Development</span>
        </a>
      </div>
      <div class="list">
        <ul>
          <li v-for="(item,i) in navList" :class="item.topUrl==activeNav ? 'active' : ''">
            <router-link :to="item.topUrl">{{ item.text }}</router-link>
          </li>
        </ul>
      </div>
    </div>
  </div>
</template>

<script>

import {defineComponent, getCurrentInstance, ref, reactive, onMounted} from 'vue';
import router from '@/router'

export default defineComponent({
  name: "publicTop",
  setup() {
    let navList = [
      {text: '首页', topUrl: '/home'},
      {text: '学习时间', topUrl: '/study/studyTime'},
      {text: '学习进度', topUrl: '/study/studySchedule'},
      {text: '学习周报', topUrl: '/weekly/weeklySearch'},
    ]
    let activeNav = ref('')

    onMounted(() => {
      activeNav.value = router.currentRoute.value.href
    })

    return {
      navList,
      activeNav,

    }
  }
})
</script>

<style lang="less">
.active a {
  color: #6777EF !important;
}

//导航栏
.top {
  width: 100%;
  height: 64px;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 3px 6px 1px rgba(0, 0, 0, 0.04);
  position: fixed;
  top: 0;
  left: calc(50% - 1920px/2);
  z-index: 99;

  .content {
    width: 1200px;
    margin: 0 auto;
    height: 64px;
    line-height: 64px;
    display: flex;
    justify-content: space-between;

    .logo {
      z-index: 99;
      cursor: pointer;

      span {
        color: #6777EF;
        font-weight: 600;
        margin-left: 12px;
        font-size: 16px;
      }
    }

    .list {
      z-index: 99;
      width: 474px;
      height: 64px;
      line-height: 64px;

      ul {
        width: 474px;
        display: flex;
        justify-content: space-between;

        li {
          float: left;

          a {
            font-size: 14px;
            color: #000;
            cursor: pointer;

          }
        }
      }
    }
  }
}
</style>
